const jwt = require('jsonwebtoken')

export const sanitizeData = (value) => {
  if (!value) return null;

  return value;
}

export const createToken = (userId, username) => {
  if (!userId || !username) {
    throw new Error('用户ID和用户名不能为空');
  }

  return jwt.sign({ userId, username }, import.meta.env.VITE_SECRET_KEY, { expiresIn: '24h' });
}
